package com.whut.entryservice.mq.producer;

import com.whut.clcommon.config.RabbitMQConfig;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

/**
 * @Description: RabbitMQ消息生产者
 * @Author: Zonghe Wang
 * @Date: 2025/5/4 17:38
 */
@Component
@RequiredArgsConstructor
public class RabbitProducer {

    private final RabbitTemplate rabbitTemplate;

    public void sendEntryMessage(String message) {
        rabbitTemplate.convertAndSend(RabbitMQConfig.ENTRY_EXCHANGE, RabbitMQConfig.ENTRY_ROUTING, message);
    }

    public void sendCancelEntryMessage(String message) {
        rabbitTemplate.convertAndSend(RabbitMQConfig.CANCEL_ENTRY_EXCHANGE, RabbitMQConfig.CANCEL_ENTRY_ROUTING, message);
    }
}
